/*******************************************************************************
* File Name: Current_sense.h
* Version 1.00
*
* Description:
*  This file provides the source code to the API for the Sequencing Successive
*  Approximation ADC Component Component.
*
* Note:
*
********************************************************************************
* Copyright 2010-2019, CMS Semiconductor Corporation.  All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/

#ifndef __CURRENT_SENSOR_H__
#define __CURRENT_SENSOR_H__

#ifdef __cplusplus
extern "C"
{
#endif

/*****************************************************************************/
/* Include files */
/*****************************************************************************/


/*****************************************************************************/
/* Global pre-processor symbols/macros ('#define') */
/*****************************************************************************/

						
/*****************************************************************************/
/* Global type definitions ('typedef') */
/*****************************************************************************/
typedef struct {
	signed short ad_t2;
	signed short ad_t1;
	signed short ad_dump;
	signed short AD_Offeset;
			
	signed long it1;
	signed long it2_sub_it1;
	signed long neg_it2;

	signed short sector_pre;
	signed short sector;
	signed short ACCP_num;
	signed short OCCP_update_pointer;
	signed short ACCP_index;			
} SingleShuntS;

typedef struct {
	signed long    U;
	signed long    V;
	signed long    W;
	signed long    SampleNum;
} OffsetS;

typedef struct {
	signed long Motor0_Q12_Current_Factor;
	signed long Motor1_Q12_Current_Factor;
	volatile unsigned char 	Motor0_Complete_f;
	volatile unsigned char  Motor1_Complete_f;
	signed long Q12_VBusk;
	signed long Q21_InvVbusk;
	signed long Q12_Vack;
	signed long Q12_Iack;
} SensorParmeterS;

/*****************************************************************************/
/* Global variable declarations ('extern', definition in C source) */
/*****************************************************************************/
extern SensorParmeterS Sensor_inform;
extern volatile unsigned char Motor0_Sensor_Status;
extern volatile unsigned char Motor1_Sensor_Status;

/*****************************************************************************/
/* Global function prototypes ('extern', definition in C source) */
/*****************************************************************************/
extern void Motor0_Sensor_Offeset_Detect(void);

extern void Motor0_Sense(void);

#ifdef __cplusplus
}
#endif

#endif /* __CURRENT_SENSOR_H__ */

